<%--
  Created by IntelliJ IDEA.
  User: 陈林
  Date: 2020/2/17
  Time: 9:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8" isELIgnored="false" pageEncoding="utf-8"%>
<%@ include file="/webpage/common/include/taglib.jsp"%>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <%@ include file="/webpage/common/include/ltie9.jsp"%>
    <!--<script type="text/javascript" src="/resources/lib/html5shiv.js"></script>-->
    <!--<script type="text/javascript" src="/resources/lib/respond.min.js"></script>-->
    <![endif]-->
    <%--<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />--%>
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/h-ui.admin/css/H-ui.admin.css" />
    <%--<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />--%>
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/h-ui.admin/skin/default/skin.css" id="skin" />
    <%--<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />--%>
    <%@include file="/webpage/common/include/head.jsp"%>
    <!--[if IE 6]>
    <%@ include file="/webpage/common/include/ltie6.jsp"%>
    <!--<script type="text/javascript" src="/resources/lib/DD_belatedPNG_0.0.8a-min.js" ></script>-->
    <!--<script>DD_belatedPNG.fix('*');</script>-->
    <![endif]-->
    <title>菜单管理</title>
</head>
<body>
<div class="page-container">
    <form action="/sys/menu/saveinter" method="get" class="form form-horizontal" id="form-category-add">
        <div id="tab-category" class="HuiTab">
            <div class="tabBar cl">
                <span>基本设置</span>
            </div>
            <div class="tabCon">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>&nbsp;菜单ID：</label>
                    <div class="formControls col-xs-4 col-sm-4">
                        <input type="text" class="input-text" value="" placeholder="" id="pid" name="pid" readonly = "readonly">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">
                        <span class="c-red">*</span>
                        上级菜单：</label>
                    <div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						<select class="select" id="sel_Sub" name="parentId">
							<option value="0">--无上级菜单--</option>
                            <c:forEach items="${menus}" var="menu">
                                <c:if test="${menu.parentId == 0}">
			    				    <option value="${menu.pid}">${menu.menuName}</option>
                                </c:if>
                            </c:forEach>
						</select>
						</span>
                    </div>
                    <div class="col-3">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">
                        <span class="c-red">*</span>
                        菜单名称：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="" placeholder="输入菜单名称" id="" name="menuName">
                    </div>
                    <div class="col-3">
                    </div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">
                        <span class="c-red">*</span>
                        url：</label>
                    <div class="formControls col-xs-4 col-sm-3">
                        <input type="text" class="input-text" value="" placeholder="输入资源地址" id="" name="url">
                    </div>
                    <div class="col-3">
                    </div>
                    <label class="form-label col-xs-2">图标：</label>
                    <div class="formControls col-xs-4 col-sm-1">
                        <output type="text"  class="formControls col-xs-2  input-text" style="cursor: pointer;text-align:center; " value="" readonly="readonly" placeholder="请选择图标" id="iconId" name="icon">
                        </output>
                    </div>
                    <div class="col-3">
                    </div>

                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">
                        <span class="c-red">*</span>
                        添加url：</label>
                    <div class="formControls col-xs-4 col-sm-3">
                        <input type="text" class="input-text" value="" placeholder="输入资源地址" id="" name="addUrl">
                    </div>
                    <div class="col-3">
                    </div>
                    <label class="form-label col-xs-2">
                        <span class="c-red">*</span>
                        修改url：</label>
                    <div class="formControls col-xs-4 col-sm-4">
                        <input type="text" class="input-text" value="" placeholder="输入资源地址" id="" name="updUrl">
                    </div>
                    <div class="col-3">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-3">
                        <span class="c-red">*</span>
                        删除url：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="" placeholder="输入资源地址" id="" name="delUrl">
                    </div>
                    <div class="col-3">
                    </div>
                </div>
            </div>
        </div>
        <div class="row cl">
            <div class="col-9 col-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</div>

<!--_footer 作为公共模版分离出去-->
<%@include file="/webpage/common/include/footer.jsp"%>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="${ctxLib}/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${ctxLib}/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="${ctxLib}/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="${ctxLib}/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">

    $(function(){
        // if(parent.jsonMsg.pid != undefined){
        //     $('#parentId').val(parent.jsonMsg.pid);
        //     $("#sel_Sub").find("option[value='10']").attr("selected",true);
        //     pidCode();
        // }
        $('#sel_Sub').click(function () {
            var flag = $(this).val();
            if(flag == 0){
                $('#parentId').val('0');
            }
            pidCode();
        });
        //随机生成pid
        function pidCode() {
            var code = "";
            for(var i = 1;i <= 6;i++){
                const num = Math.floor(Math.random()*10);
                code += num;
            }
            $('#pid').val() == ''?$('#pid').val(code):"";
            console.log(code);
        }



        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#tab-category").Huitab({
            index:0
        });
        $("#form-category-add").validate({
            rules:{

            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit();
                var index = parent.layer.getFrameIndex(window.name);
                //parent.$('.btn-refresh').click();
                parent.location.reload(); // 父页面刷新
                parent.layer.close(index);
            }
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
